package com.cdream.basic.util;

/**
 * @author cdream
 * @date 2020-06-14
 */
public class JSONUtilExample {
    private static final String COMPLETE = "complete";
    private static final String NOT_COMPLETE = "not_complete";

    public static void main(String[] args) {

        // OrderDO orderDO = OrderDO.builder()
        //         .id(1).state(COMPLETE)
        //         .createTime(DateUtil.parse("20200101"))
        //         .totalAccount(ONE).build();
        // // 转String
        // String orderStr = JSON.toJSONString(orderDO);
        // System.out.println("orderStr:" + orderStr);
        // // 转Object
        // OrderDO orderDO1 = JSONObject.parseObject(orderStr,OrderDO.class);
        // System.out.println("orderDO1:" + orderDO1);
        //
        // // 泛型处理
        // List<OrderDO> orderDOS = CollUtil.newArrayList(orderDO);
        // String ordersStr = JSON.toJSONString(orderDOS);
        // System.out.println("ordersStr:" + ordersStr);
        //
        // List<OrderDO> orderDOS1 = JSONObject.parseObject(ordersStr, new TypeReference<List<OrderDO>>() {
        // });
        // System.out.println("orderDOS1:" + orderDOS1);

        String s= "{\n" +
                "  \"ipPort\": \"139.59.106.165:8080\",\n" +
                "  \"ip\": \"139.59.106.165\",\n" +
                "  \"port\": \"8080\",\n" +
                "  \"country\": \"SG\",\n" +
                "  \"last_checked\": \"2020-12-17 06:06:50\",\n" +
                "  \"proxy_level\": \"anonymous\",\n" +
                "  \"type\": \"http\",\n" +
                "  \"speed\": \"9\",\n" +
                "  \"support\": {\n" +
                "    \"https\": 1,\n" +
                "    \"get\": 1,\n" +
                "    \"post\": 1,\n" +
                "    \"cookies\": 1,\n" +
                "    \"referer\": 1,\n" +
                "    \"user_agent\": 1,\n" +
                "    \"google\": 0\n" +
                "  }\n" +
                "}";
    }
}
